/*
 * This file Copyright (c) 2015. Walle.
 * (http://www.wallellen.com). All rights reserved.
 *
 *
 * This file is dual-licensed under both the
 * Walle Agreement (WA) and the GNU General Public License.
 * You may elect to use one or the other of these licenses.
 *
 * This file is distributed in the hope that it will be
 * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
 * Redistribution, except as permitted by whichever of the GPL
 * or WA you select, is prohibited.
 *
 * 1. For the GPL license (GPL), you can redistribute and/or
 * modify this file under the terms of the GNU General
 * Public License, Version 3, as published by the Free Software
 * Foundation.  You should have received a copy of the GNU
 * General Public License, Version 3 along with this program;
 * if not, write to the Free Software Foundation, Inc., 51
 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * 2. For the Walle Agreement (WA), this file
 * and the accompanying materials are made available under the
 * terms of the WA which accompanies this distribution, and
 * is available at http://www.wallellen.com/agreement.html
 *
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
 */

package com.wallellen.knowledge.doc.server;

import com.wallellen.core.auth.domain.LoginUser;
import com.wallellen.core.sql.result.DataResult;
import com.wallellen.knowledge.doc.domain.DocType;
import com.wallellen.knowledge.doc.domain.ex.TypeBrief;
import com.wallellen.knowledge.plus.domain.Doctypepop;

import java.util.List;


/**
 * 文档分类
 *
 * @author <a href="mailto:wallellen@hotmail.com">WALLE</a>
 * @version 20140902
 */
public interface DocTypeInter {

    /**
     * 新增分类
     *
     * @param entity
     */
    public DocType insertType(DocType entity, LoginUser user);

    /**
     * 修改分类
     *
     * @param entity
     */
    public DocType editType(DocType entity, LoginUser user);

    /**
     * 删除分类实体
     *
     * @param entity
     */
    public void deleteType(String entity, LoginUser user);

    /**
     * 获得分类实体
     *
     * @param id
     * @return
     */
    public DocType getType(String id);

    /**
     * 获得一个分类的所有上层节点序列（包含该分类，有排序）
     *
     * @param typeid
     * @return
     */
    public List<DocType> getTypeAllParent(String typeid);

    /**
     * 获取知识分类详细信息（带分类下知识数量）（下级分类和下下级别分类）
     *
     * @param query
     * @return
     */
    public List<TypeBrief> getTypeInfos(LoginUser user, String parentId);

    /**
     * 获得分类下的知识
     *
     * @return DOCID, title, DOCDESCRIBE, AUTHOR, PUBTIME, TAGKEY
     * ,IMGID,VISITNUM,PRAISEYES,PRAISENO,HOTNUM,EVALUATE,ANSWERINGNUM,
     * TYPENAME,DOMTYPE,TYPEID
     */
    public DataResult getTypeDocs(LoginUser userid, String typeid, int pagesize, int currentPage);


    /**
     * 查询分类的权限(检查该分类的所有上级节点，并获取权限信息)
     *
     * @param query
     * @param type
     * @param typeid
     * @return
     */
    public List<Doctypepop> getTypePops(String typeid);


    /**
     * 获得分类所有子节点
     *
     * @param typeid
     * @return
     */
    public List<DocType> getAllSubNode(String typeid);


    /**
     * 获取知识分类信息（带分类下知识数量）
     *
     * @param query
     * @return
     */
    public List<TypeBrief> getPubTypes();

    /**
     * 获取知识分类信息（带分类下知识数量）
     *
     * @param user user可空
     * @return
     */
    public List<TypeBrief> getPubTypesForReadDoc(LoginUser user);

    /**
     * 获得用户所有（被授权阅读的受限分类的分类的ID）（阅读） ///////受限分类是相对于为分配权限的分类（为分配权限的分类，所有人均可访问）
     *
     * @param user
     * @return
     */
    public List<String> getUserReadTypeIds(LoginUser user);

    /**
     * 获取知识分类信息（带分类下知识数量）用于创建知识时候的
     *
     * @param user
     * @return
     */
    public List<TypeBrief> getPubTypesForWriteDoc(LoginUser user);

    /**
     * 获得用户所有（需要其审核的）分类的ID列表
     *
     * @param userid 用户id
     * @return
     */
    public List<String> getUserAuditTypeIds(String userid);

    /**
     * 获得分类的审核人ID列表
     *
     * @param typeid
     * @return
     */
    public List<String> getTypeAudtUserIds(String typeid);
}
